package start.eventbus;

import com.google.common.eventbus.EventBus;
import start.entity.Book;

public class EventBusTest {
    public static void main(String[] args) {
        EventBus eventBus = new EventBus((throwable, subscriberExceptionContext) -> {
            System.out.println("执行出错");
            return;
        });
        eventBus.register(new EventListener01());
        eventBus.register(new EventListener02());
        eventBus.register(new EventListener03());
        //int类型监听
        eventBus.post(1);
        //String类型监听
        eventBus.post("3");
        //Book对象监听
        Book book = new Book();
        book.setName("AAA");
        book.setAge(30);
        eventBus.post(book);

    }


}
